//
//  AySearchBar.m
//  xWeibo
//
//  Created by alvis mac on 11/5/15.
//  Copyright © 2015 alvis. All rights reserved.
//

#import "AySearchBar.h"
#import "UIImageExtend.h"
@implementation AySearchBar

- (instancetype)initWithFrame:(CGRect)frame{
    self=[super initWithFrame:frame];
    if (self) {
        
         self.background = [UIImage resizedImageWithName:@"searchbar_textfield_background"];
        self.placeholder = @"搜索";
        self.clearButtonMode = UITextFieldViewModeWhileEditing;
        self.returnKeyType = UIReturnKeySearch;
        self.enablesReturnKeyAutomatically = YES;
        
        UIImageView *leftIcon = [[UIImageView alloc] initWithImage:[UIImage imageWithName:@"searchbar_textfield_search_icon"]];
        leftIcon.contentMode = UIViewContentModeCenter;
        leftIcon.bounds = CGRectMake(0, 0, 25, 25);
        self.leftView = leftIcon;
        self.leftViewMode = UITextFieldViewModeAlways;
        self.font = [UIFont systemFontOfSize:14];
    }
    return self;
}
@end
